package com.iscale.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.iscale.model.entity.SysBusinessType;
import com.iscale.mapper.SysBusinessTypeMapper;
import com.iscale.model.entity.SysDictionary;
import com.iscale.service.SysBusinessTypeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.iscale.util.StringUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 业务类型 服务实现类
 * </p>
 *
 * @author Andychen
 * @since 2017-03-10
 */
@Service
public class SysBusinessTypeServiceImpl extends ServiceImpl<SysBusinessTypeMapper, SysBusinessType> implements SysBusinessTypeService {

    @Override
    public List<SysBusinessType> selectBusinessTypes(Long id, String name){
        //从数据查询
        EntityWrapper<SysBusinessType> entityWrapper = new EntityWrapper<>(new SysBusinessType());
        entityWrapper.where("status={0}",0);
        if(null!=id && id>0){
            entityWrapper.andNew("id={0}",id);
        }
        if(StringUtil.isNotEmpty(name)){
            entityWrapper.like("name",name);
        }
        List<SysBusinessType> sysBusinessTypeList = selectList(entityWrapper);
        return  sysBusinessTypeList;
    }
}
